package com.zhhs.jzcd.material.service.impl;

import java.util.List;
import com.zhhs.common.utils.DateUtils;
import com.zhhs.common.utils.spring.SpringUtils;
import com.zhhs.project.system.domain.SysDept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhhs.jzcd.material.mapper.BaseMaterialMapper;
import com.zhhs.jzcd.material.domain.BaseMaterial;
import com.zhhs.jzcd.material.service.IBaseMaterialService;

/**
 * 素材库Service业务层处理
 *
 * @author ruoyi
 * @date 2023-08-03
 */
@Service
public class BaseMaterialServiceImpl implements IBaseMaterialService
{
    @Autowired
    private BaseMaterialMapper baseMaterialMapper;

    /**
     * 查询素材库
     *
     * @param id 素材库主键
     * @return 素材库
     */
    @Override
    public BaseMaterial selectBaseMaterialById(Long id)
    {
        return baseMaterialMapper.selectBaseMaterialById(id);
    }

    /**
     * 查询素材库列表
     *
     * @param baseMaterial 素材库
     * @return 素材库
     */
    @Override
    public List<BaseMaterial> selectBaseMaterialList(BaseMaterial baseMaterial)
    {
        return baseMaterialMapper.selectBaseMaterialList(baseMaterial);
    }

    /**
     * 新增素材库
     *
     * @param baseMaterial 素材库
     * @return 结果
     */
    @Override
    public int insertBaseMaterial(BaseMaterial baseMaterial)
    {
        baseMaterial.setCreateTime(DateUtils.getNowDate());
        return baseMaterialMapper.insertBaseMaterial(baseMaterial);
    }

    /**
     * 修改素材库
     *
     * @param baseMaterial 素材库
     * @return 结果
     */
    @Override
    public int updateBaseMaterial(BaseMaterial baseMaterial)
    {
        baseMaterial.setUpdateTime(DateUtils.getNowDate());
        return baseMaterialMapper.updateBaseMaterial(baseMaterial);
    }

    /**
     * 批量删除素材库
     *
     * @param ids 需要删除的素材库主键
     * @return 结果
     */
    @Override
    public int deleteBaseMaterialByIds(Long[] ids)
    {
        return baseMaterialMapper.deleteBaseMaterialByIds(ids);
    }

    /**
     * 删除素材库信息
     *
     * @param id 素材库主键
     * @return 结果
     */
    @Override
    public int deleteBaseMaterialById(Long id)
    {
        return baseMaterialMapper.deleteBaseMaterialById(id);
    }

    /**
     * 批量移动素材库
     */
    @Override
    public int batchMove(Long[] ids, Long categoryId){
        return baseMaterialMapper.batchMove(ids, categoryId);
    }
}
